/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.member;

import com.enation.app.javashop.client.member.ShopClient;
import com.enation.app.javashop.core.client.fallback.member.ShopClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.shop.dos.ShopDO;
import com.enation.app.javashop.model.shop.dto.ShopBankDTO;
import com.enation.app.javashop.model.shop.vo.ShopVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 店铺接口Feign实现
 *
 * @author kingapex
 * @version 1.0
 * @since 7.0.0
 * 2018/7/6
 */
@FeignClient(name = "member-service", fallbackFactory = ShopClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface ShopClientFeigntImpl extends ShopClient {

    /**
     * 获取一个店铺
     *
     * @param shopId 店铺id
     * @return
     */
    @Override
    @RequestMapping(value = "/client/shops/{shop_id}", method = RequestMethod.GET)
    ShopVO getShop(@PathVariable("shop_id") Long shopId);

    /**
     * 获取所有店铺的银行信息佣金比例
     *
     * @return
     */
    @Override
    @RequestMapping(value = "/client/shops/bank-info", method = RequestMethod.GET)
    List<ShopBankDTO> listShopBankInfo();

    /**
     * 增加收藏数量
     *
     * @param shopId 店铺id
     */
    @Override
    @RequestMapping(value = "/client/shops/collection/{shop_id}", method = RequestMethod.POST)
    void addCollectNum(@PathVariable("shop_id") Long shopId);

    /**
     * 减少收藏数量
     *
     * @param shopId
     */
    @Override
    @RequestMapping(value = "/client/shops/{shop_id}/collection", method = RequestMethod.POST)
    void reduceCollectNum(@PathVariable("shop_id") Long shopId);

    /**
     * 计算店铺评分
     */
    @Override
    @RequestMapping(value = "/client/shops/calculate-shop-score", method = RequestMethod.GET)
    void calculateShopScore();

    /**
     * 更新店铺的商品数量
     *
     * @param sellerId
     * @param sellerGoodsCount
     */
    @Override
    @RequestMapping(value = "/client/shops/{seller_id}/shop-goods-num", method = RequestMethod.POST)
    void updateShopGoodsNum(@PathVariable("seller_id") Long sellerId, @RequestParam("seller_goods_count") Integer sellerGoodsCount);

    /**
     * 获取店铺总数
     * @return
     */
    @Override
    @RequestMapping(value = "/client/shops/shop-all-count", method = RequestMethod.GET)
    int queryShopCount();

    /**
     * 根据范围查询店铺信息
     * @param i
     * @param pageSize
     * @return
     */
    @Override
    @RequestMapping(value = "/client/shops/range", method = RequestMethod.GET)
    List<ShopDO> queryShopByRange(@RequestParam("page_no") Long i, @RequestParam("page_size")Long pageSize);

}
